package cn.yh.ysyx.controller;

import cn.yh.ysyx.common.result.Result;
import cn.yh.ysyx.service.RoleService;
import cn.yh.ysyx.vo.acl.RoleQueryVo;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@Api(tags = "角色管理")
@RestController
@RequestMapping("/admin/acl/role")
@CrossOrigin //跨域
public class RoleController {
    @Autowired
    RoleService roleService;

   //分页获取角色列表
    @ApiOperation(value = "分页获取角色列表")
    @GetMapping("{page}/{limit}")
    public Result index(  @ApiParam(name = "page", value = "当前页码", required = true) @PathVariable Long page,
                          @ApiParam(name = "limit", value = "分页单位", required = true) @PathVariable Long limit ,
                          RoleQueryVo roleQueryVo) {
        //构建分页条件
        Page pageParam = new Page(page, limit);
        IPage iPage = roleService.selectPage(pageParam, roleQueryVo);
        return Result.ok(iPage);
    }
}
